package com.bwie.shop.controller;

import com.bwie.common.domain.request.ShopEntryRequest;
import com.bwie.common.domain.request.ShopListRequest;
import com.bwie.common.domain.response.ShopListResponse;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.shop.service.ShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 店铺控制层
 *
 * @author <a href="mailto:3364114353@qq.com">liuwenliang</a>
 * @version 1.0
 * @description: 店铺控制层
 * @date 2025/9/9 12:06
 */
@RestController
@RequestMapping("/shop")
@CrossOrigin
public class ShopController {

   @Autowired
   private ShopService shopService;

   /**
    * 店铺列表，分页
    * @param shopListRequest
    * @return 列表
    */
   @PostMapping("/getShopList")
   public Result<PageResult<ShopListResponse>> getShopList (@RequestBody ShopListRequest shopListRequest) {
      PageResult<ShopListResponse> shopList  = shopService.getShopList(shopListRequest);
      return Result.success(shopList);
   }


   /**
    * 店铺入驻
    * @param shopEntryRequest
    * @return 是否入驻成功
    */
   @PostMapping("/storeEntry")
   public Result storeEntry (@RequestBody ShopEntryRequest shopEntryRequest) {
      shopService.storeEntry(shopEntryRequest);
      return Result.success();
   }

   /**
    * 审核资格校验
    * @return
    */
   @GetMapping("/review")
   public Result<String> review () {
      String str = shopService.review();
      return Result.success(str);
   }

   /**
    * 导出
    * @return
    */
   @GetMapping("/export")
   public Result export () {
      shopService.export();
      return Result.success();
   }
}
